import upload from '@/utils/upload.js'
import request from '@/utils/request'
// 图片上传方法
export function uploadAvatar(data) {
	return upload({
		url: '/uploadController/open/ossUploadCustomizeFileName?filePath=' + data.filePath + "&folderName=" +
			data.folderName,
		method: 'post'
	})
}
// 修改用户信息
export function updateNickName(data) {
	return request({
		url: '/memberInfoApp/update?nickname=' + data,
		method: 'post',
	})
}
// 修改用户头像
export function updateAvatar(data) {
	return request({
		url: '/memberInfoApp/update?avatar=' + data,
		method: 'post',
	})
}
// 使用老密码更新密码
export function updateByOldPassword(data) {
	// console.log(data)
	return request({
		url: '/developer/systemUser/modifyPassword/' + data.id + "?password=" + data.password +
			"&newPassword=" +
			data.newPassword,
		method: 'post',
	})
}
// 更改密码
export function updatePassword(data) {
	return request({
		url: '/developer/systemUser/setPassword/' + data.id + "?password=" + data.password,
		method: 'post',
	})
}
// 实名认证
export function realName(data) {
	return request({
		url: '/memberInfoApp/realName?name=' + data.name + "&idNumber=" + data.idNumber + "&phone=" + data
			.phone + "&bankCard=" + data.bankCard,
		method: 'post',
	})
}
//安全密码
// export function updateTransactionPassword(data) {
// 	return request({
// 		url:" /memberInfoApp/updateTransactionPassword",
// 		'method': 'post',
// 		data: data
// 	})
// }

export function updateTransactionPassword(data) {
	return request({
		url: '/memberInfoApp/updateTransactionPassword?phone=' + data.phone +
			"&transactionPassword=" + data.transactionPassword + "&verificationCode=" + data.verificationCode,
		method: 'post',
	})
}
//添加收货地址
export function addAddress(data) {
	return request({
		url: '/userAddressApp/add/0?isDefault=' + data.isDefault + "&receiver=" +
			data.receiver + "&phone=" + data.phone + "&province=" +
			data.province + "&city=" + data.city + "&county=" +
			data.county + "&address=" + data.address,
		method: 'post',
	})
}
//修改收货地址
export function updateAddress(data) {
	return request({
		url: '/userAddressApp/update/' + data.orgDefaultId + "?receiver=" +
			data.receiver + "&phone=" + data.phone + "&province=" +
			data.province + "&city=" + data.city + "&county=" +
			data.county + "&address=" + data.address + "&isDefault=" + data.isDefault + "&id=" + data.id,
		method: 'post',
	})
}
//获取地址列表
export function getAddressList() {
	return request({
		url: '/userAddressApp/getAll',
		method: 'get',
	})
}
//删除地址
export function deteleAddress(id) {
	return request({
		url: '/userAddressApp/delete/' + id,
		method: 'get',
	})
}
// 隐私协议
export function onPrivacyPolicy(data) {
	return request({
		url: '/privacyPolicyApp/auth/getAll/2',
		headers: {
			isToken: false,
		},
		method: 'get',
	})
}

// 用户协议
export function getuserRule(data) {
	return request({
		url: '/personalAgreementApp/auth/getAll/2',
		headers: {
			isToken: false,
		},
		method: 'get',
	})
}
// 关于我们
export function aboutUs(data) {
	return request({
		url: '/aboutUsApp/auth/getAll/2',
		headers: {
			isToken: false,
		},
		method: 'get',
	})
}
// 注销账号
export function logOff(data) {
	return request({
		url: '/memberInfoApp/open/logOff',
		method: 'post',
	})
}